package com.example.config;

import io.minio.MinioClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 作者:xuSen
 * 日期2025/4/25 12:58
 */
@Slf4j
@Configuration
public class MinioConfiguration {
    @Value("${spring.minio.endpoint}")
    private String endpoint;
    @Value("${spring.minio.username}")
    private String username;
    @Value("${spring.minio.password}")
    private String password;
    @Bean
    public MinioClient minioClient() {
        log.info("初始化minio");
        return  MinioClient.builder()
                .endpoint(endpoint)  //对象存储服务地址，注意是9000那个端口
                .credentials(username, password)   //账户直接使用管理员
                .build();
    }
}
